import { defineStore } from "pinia";
import searchApi from '@/api/search'

export const useSearchStore = defineStore('search',{
    state:()=>{
        return {           
            hotKeywordList:[],
            autoCompleteList:[]
        }
    },
    actions:{
        async getkeyWordList(){
            const res = await searchApi.reqKeyword()
            this.hotKeywordList = res.data.hotKeywordVOList.map((item: { keyword: any; })=>item.keyword)
        },
        async getAutoCompleteList(data:any){
            const res = await searchApi.reqAutoKeyword(data)
            // console.log(res);
            this.autoCompleteList = (res as any).data
            console.log('rrrr',this.autoCompleteList);
            
        }
    }
})